package com.ykq.handler;

import com.ykq.vo.R;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @Author: 闫克起
 * @Description:
 * @Date: Create in 11:40 2024/10/12
 */
@ControllerAdvice
public class MyExceptionHandler {

    @ExceptionHandler(Exception.class)
    @ResponseBody
    public R handler(Exception e) {
        e.printStackTrace(); //打印异常信息 方便找错误
        return R.error(e.getMessage());
    }
}
